home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group95b.txt
/
000048_icon-group-sender _Sat Jun 17 17:43:19 1995.msg
< prev
next >
Wrap
Internet Message Format
|
1995-09-18
|
4KB
Received: by cheltenham.cs.arizona.edu; Mon, 19 Jun 1995 09:02:00 MST
To: icon-group@cs.arizona.edu
Date: Sat, 17 Jun 1995 17:43:19 GMT
From: john@nmt.edu (John Shipman)
Message-Id: <1995Jun17.174319.29735@nmt.edu>
Organization: Zoological Data Processing
Sender: icon-group-request@cs.arizona.edu
References: <1995Jun16.172604.22642@leeds.ac.uk>
Subject: Re: Perl v. Icon
Errors-To: icon-group-errors@cs.arizona.edu
I've been a heavy Icon user for a year or so now, and I think
it's a good choice for text processing applications, especially
when you need a good selection of data structures.
Let me give you an example of the sort of thing I do all the
time in Icon, so you can assess whether your needs are similar.
Next week I'll be starting a project to display the ``knowledge
base'' of the New Mexico Tech Computer Center staff in two
different forms---as typeset copy and as web pages.
The input is a list of skills (C++, hardware repair, etc.),
structured as a three-level hierarchy (major category, minor
category, and skill name), with each skill followed by a list
of people who have that skill, and a rating of B for beginner,
I for intermediate, and E for expert.
This input file is to be processed by two different Icon
programs.
The first translates the skill list into a fully ruled table
using TeX notation. The initials of the people are placed
on column headings across the top, and the skills names
are the row headings running down the left side. At each
cell is the skill level code.
The second program will translate the same list into a web
structured in this manner:
* The first page will be a bullet list, with links pointing
to pages for each major skill category (user skills,
help desk skills, system programming skills).
* The major-category pages are bullet lists pointing to
minor-category pages. For example, the user page will
have a bullet for programming languages.
* Each minor-category page lists each skills (e.g., C++)
followed by a list of the experts, the intermediates,
and the beginners. Each name on the list is a link to
a page with name, schedule and contact info for that
person.
Icon is really ideal for this sort of small textual database
application. Parsing the input file is quite trivial, there's
not much to it.
Ideally, though, in order to reuse the part of the program that
parses the input, I want to build an object that represents the
entire knowledge base, and provide methods on that object that
cover the repertoire of functions that the two different
applications will need. Although Icon is not technically an
object-oriented language, I can still get the kind of
encapsulation and abstraction that I need.
Inside the object, I clearly need a heterogeneous tree that
allows me to jump from major category to minor category to skill
to person. The Icon concept of generators gives me a foolproof
way to allow the caller to visit each child of a parent node, for
example, without having to worry about how the tree is
structured.
I must confess that I don't know much Perl. I have looked at
some scripts a few dozen lines long. As far as I can tell, the
only reason people put up with the rather ugly and cryptic syntax
of Perl is that it's useful for system administration tasks. I'm
not a sysadmin; my title is ``Applications Specialist.''
As a further disclaimer, I'm rather manic about good style. I
want my programs to be legible, and I find that Icon gives me
a very natural expression of the problem. I also find that
modifying programs is straightforward.
Since I discovered Icon, I have written negligible amounts of C,
and nothing in Awk. Most of my work involves transformation of
text input files into text output files (although I have done a
little work with portable binary encodings in files), and I'd say
I'm three times as productive as with C and twice Awk.
--
John Shipman (js@cs.nmt.edu)
``Let's go outside and commiserate with nature.'' --Dave Farber